]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
panelMenu: Show/hide the indicators box based on indicator visibility
authorJasper St. Pierre <jstpierre@mecheye.net>
Mon, 15 Jul 2013 23:46:25 +0000 (19:46 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Tue, 13 Aug 2013 10:50:24 +0000 (06:50 -0400)
This ensures that there's no empty space in the indicators box, and we don't
have to manage it manually.

https://bugzilla.gnome.org/show_bug.cgi?id=705845

js/ui/panelMenu.js

index f6c48a4507b357d679c3c9c29aaa34b35ad3cc8d..8bad21d75c1aeddf7d4ccaaf3948f3b91eb3781a 100644 (file)
@@ -241,13 +241,22 @@ const SystemIndicator = new Lang.Class({
     _init: function() {
         this.indicators = new St.BoxLayout({ style_class: 'panel-status-indicators-box',
                                              reactive: true });
+        this.indicators.hide();
         this.menu = new PopupMenu.PopupMenuSection();
     },
 
+    _syncIndicatorsVisible: function() {
+        this.indicators.visible = this.indicators.get_children().some(function(actor) {
+            return actor.visible;
+        });
+    },
+
     addIndicator: function(gicon) {
         let icon = new St.Icon({ gicon: gicon,
                                  style_class: 'system-status-icon' });
         this.indicators.add_actor(icon);
+        icon.connect('notify::visible', Lang.bind(this, this._syncIndicatorsVisible));
+        this._syncIndicatorsVisible();
         return icon;
     }
 });